import 'package:fate_blind_box/routes/page_route_names.dart';
import 'package:flutter/foundation.dart';
import 'package:get/get.dart';

import 'state.dart';

class PaymentSetupLogic extends GetxController {
  final PaymentSetupState state = PaymentSetupState();

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    if (state.isPaymentPasswordSet) {
      state.paymentMethod.addAll(['修改支付密码', '忘记支付密码']);
    } else {
      state.paymentMethod.addAll(['设置支付密码']);
    }
  }

  changePaymentMethod(String paymentMethod) {
    debugPrint('changePaymentMethod: $paymentMethod');
    if (paymentMethod == '设置支付密码') {
      Get.toNamed(PageRouteNames.setPaymentPassword);
    } else if (paymentMethod == '修改支付密码') {
      Get.toNamed(PageRouteNames.verifyPaymentPassword);
    } else if (paymentMethod == '忘记支付密码') {
      Get.toNamed(PageRouteNames.phoneVerification);
    }
  }
}
